import * as THREE from 'three'
import { FaGuangTi } from './FaGuangTi.js'
import { huanJing } from '../../huanJing/HuanJing.js'
import { ceShiJieJuLi } from '../../gongJu/gongJu.js'

// 恒星
export class HengXing extends FaGuangTi {
	banJing = null
	shiHengXing = true // 是恒星

	/**
	 * @param {Number|String} yanSe 恒星颜色 光源颜色
	 * @param {Number} banJing 恒星半径
	 * @param {Number} jiaZaiJuLi 加载距离
	 */
	constructor(yanSe = 0xffeedd, banJing = 1500, jiaZaiJuLi = Infinity) {
		const geometry = new THREE.SphereGeometry( banJing, 32, 16 );
		const material = new THREE.MeshStandardMaterial({ color: yanSe });
		const sphere = new THREE.Mesh( geometry, material );
		let pengZhuang = sphere.clone()
		pengZhuang.userData.xingZhuang = '球体'

		super(sphere, pengZhuang, 0, yanSe, 0.5, 0, 20000)

		this.banJing = banJing
		
		this.tongBuWuLi = false
		this.jiaZaiJuLi = jiaZaiJuLi
		this.dianGuangYuan.decay = 0 // distance == 0也会衰减所以设置0
		this.dianGuangYuan.castShadow = true
	}
}